<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<link rel="stylesheet" href="../../assets/css/layui.css">
		<link rel="stylesheet" href="../../assets/css/view.css"/>
		<title></title>
	</head>
	<body>
		<div class="layui-content">
			<div class="layui-row">
				<div class="layui-card">
					<div class="layui-card-header">添加快递员</div>
					<form id="form" class="layui-form layui-card-body">
						<div class="layui-form-item">
							<label class="layui-form-label">姓名</label>
							<div class="layui-input-block">
								<input type="text" name="couriername" required  lay-verify="required" placeholder="请输入快递员姓名" autocomplete="off" class="layui-input">
							</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">手机号</label>
							<div class="layui-input-block">
								<input type="text" name="staffphone" required  lay-verify="required" placeholder="请输入快递员手机号" autocomplete="off" class="layui-input">
							</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">身份证号</label>
							<div class="layui-input-block">
								<input type="text" name="personalid" required  lay-verify="required" placeholder="请输入快递员身份证号" autocomplete="off" class="layui-input">
							</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">密码</label>
							<div class="layui-input-block">
								<input type="password" name="password" required  lay-verify="required" placeholder="请输入快递员登录密码" autocomplete="off" class="layui-input">
							</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">重复密码</label>
							<div class="layui-input-block">
								<input type="password" name="password_repeat" required  lay-verify="required" placeholder="请再次输入快递员登录密码" autocomplete="off" class="layui-input">
							</div>
						</div>
						<div class="layui-form-item">
							<div class="layui-input-block">
								<button class="layui-btn layui-btn-blue" lay-submit lay-filter="formDemo">立即提交</button>
								<button type="reset" class="layui-btn layui-btn-primary">重置</button>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
		<script src="../../assets/layui.all.js"></script>
		<script src="../../js/bootstrap/jquery.min.js"></script>
		<script src="/js/layer/layer.js"></script>
		<script src="/admin/ckeckAllInputs.js"></script>
		<script>
			var form = layui.form, layer = layui.layer;
		</script>
		<script>
			$(function () {
				$("#form").submit(function () {
					let couriername = $("input:eq(0)").val();
					let courierphone = $("input:eq(1)").val();
					let personalid = $("input:eq(2)").val();
					let password = $("input:eq(3)").val();
					let password_repeat = $("input:eq(4)").val();
					if (ifInputsByAddChecked(couriername,courierphone,personalid,password,password_repeat)){
						var windowID = layer.load(2);
						$.post("/courier/insert.do",{
							couriername:couriername,
							courierphone:courierphone,
							personalid:personalid,
							password:password
						},function(values){
							layer.close(windowID);
							if (values.status === 0) {
								$("input").val("");
								layer.msg("录入成功",{icon:6,shade:0.05});
							} else {
								layer.msg("录入失败，请检查输入的信息！",{icon:2,shade:0.05});
							}
						});
					}
					return false;
				});
			});
		</script>
	</body>
</html>
